<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .menus {
        width: 200px;
        border: solid;
        position: relative;
      }
      .menus ul {
        margin: 0;
        padding: 0;
        list-style: none;
        box-shadow: 1px 1px 5px gray;
        background: white;

        left: 0;
        right: 0;
        position: absolute;
        display: none;
      }
      .menus ul li {
        border: solid;
        margin: 5px;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    </style>
  </head>
  <body>
    <div class="menus">
      <button id="btnMenus">菜单</button>
      <ul id="menusList">
        <li>添加</li>
        <li>删除</li>
        <li>编辑</li>
      </ul>
    </div>

    <p>hello menus</p>
    <script>
      const btnMenus = document.getElementById("btnMenus");
      const menusList = document.getElementById("menusList");
      btnMenus.onclick = function () {
        if (getComputedStyle(menusList).display === "none") {
          menusList.style.display = "block";
        } else {
          menusList.style.display = "none";
        }
      };
    </script>
  </body>
</html>
